// 关于我们和产品介绍的tabs
// Object.prototype.cont_top=document.getElementById("cont_top")
// Object.prototype.lis=cont_top.getElementsByTagName("li")
// console.log(Object.prototype.lis=cont_top.getElementsByTagName("li"))
var bigtabs={
    "cont_down":document.getElementById("cont_down"),
    "articles":cont_down.getElementsByTagName("article"),
    "newsbox":document.getElementById("newsbox"),
    "cont_top":document.getElementById("cont_top"),
    "lis":cont_top.getElementsByTagName("li"),
    "span":cont_top.getElementsByTagName("p")[0].lastElementChild,
    "init":function(){//放入最终想要调用的函数
        this.bind();
        console.log(this)
    },
    "bind":function(){
        var me=this;
        for(var i=0;i<this.lis.length;i++){
            this.lis[i].onclick=function(){
                me.animate(this);
            }
        }
    },
    "animate":function(x){//所要做的事情里面在有一个清除功能
        this.clear();
        x.className="active";
        var i = x.getAttribute("xb");
        this.articles[i].className="active";
        this.span.innerHTML=x.innerHTML;
    },
    "clear":function(){
        for(var i=0;i<this.lis.length;i++){
            this.lis[i].className="";
            this.articles[i].className="";
        }
        
    }
}
bigtabs.init();

// 三级新闻
// Object.prototype.lis=cont_top.getElementsByTagName("li");

var newstabs={
    "cont_top":document.getElementById("cont_top"),
   "lis":cont_top.getElementsByTagName("li"),
   "newsbox":document.getElementById("newsbox"),
    "articles":cont_down.getElementsByTagName("article"),
    "newsbigbox":document.getElementById("newsbigbox"),
    "as":newsbigbox.getElementsByTagName("a"),
    "btns":newsbox.getElementsByTagName("button"),
    "init":function(){
        this.bind();
    },
    "bind":function(){
        var me=this;
        for(var i=0;i<this.as.length;i++){
            this.as[i].onclick=function(){
                me.animate(this);
            }
        }
        for(var i=0;i<this.btns.length;i++){
            this.btns[i].onclick=function(){
                me.animate2(this);
            }
        }
    },
    "animate":function(x){//所要做的事情里面在有一个清除功能
        this.clear();
        this.lis[1].style.display="inline-block";
        this.articles[1].firstElementChild.style.display="none";
      //  console.log(this)
        var i=x.getAttribute("xb");
        this.newsbox.style.display="block";
        this.newsbox.children[i].style.display="block";
    },
    "animate2":function(x){
        // self.location=document.referrer;
        this.clear2();
        this.articles[1].firstElementChild.style.display="block";
        var i=x.getAttribute("xb");
        this.newsbox.style.display="none";
    },
    "clear":function(){
        for(var i=0;i<this.lis.length;i++){
            this.lis[i].style.display="none";
            newsbox.children[i].style.display="none";
        }
    },
    "clear2":function(){
        for(var i=0;i<this.lis.length;i++){
            this.lis[i].style.display="block";
            newsbox.children[i].style.display="block";
        }
    }
}
newstabs.init();

// 关于我们 公司历程
var course=document.getElementById("course");
var ps=course.getElementsByTagName("p");
console.log(ps)
for(var i=0;i<ps.length;i++){
    ps[0].style.width="400px";
    ps[1].style.width="250px";
    ps[2].style.width="320px";
    ps[3].style.width="520px";
    ps[4].style.width="300px";
    ps[5].style.width="340px";
    ps[6].style.width="310px";
    ps[7].style.width="350px";
    ps[8].style.width="390px";
    ps[9].style.width="290px";
}